package user.admin;

import java.util.Scanner;

public class logon {
    public void logon(){
        Scanner sc = new Scanner(System.in);
        UserDao ud = new UserDaoImpl();
        System.out.println("--------------登录界面--------------");
        while (true) {
            System.out.println("请输入用户名：");
            String username = sc.nextLine();
            System.out.println("请输入密码：");
            String password = sc.nextLine();
            // 调用登录功能
            // UserDao ud = new UserDaomImpl();
            boolean flag = ud.isLogin(username, password);
            if (flag) {
                System.out.println("登录成功!");
                ud.Login(username, password);
                break;
            } else {
                System.out.println("用户名或者密码有误,登录失败");
            }
        }
    }
}
